import Util from './Util.js'
import module from './Module.js'
//购物车管理
class Cart {
  constructor(goods) {
    this.goods = goods
  }
  total() {
    return module.require(['Util'], (Util) => {
      return Util.total(this.goods, 'price')
    })
  }
  order(field = 'price', type = 'asc') {
    return module.require('Cart', ['Util'], (Util) => {
      goods = Util.order(this.goods, field, type)
    })
  }
}

export default Cart
